<?php 
	$modelArticle = new Model_Article_Article();
	$dataRecent = $modelArticle->getRecentArticle(5);
	$dataMostView = $modelArticle->getMostViewItems(5);
?>
<div class="home-left">
<h2>Công cụ nhanh</h2>
	<div class="home-shorcut"><a href="<?php echo $this->url(array("module"=>"administrator","controller"=>"article","action"=>"add"),null,true); ?>"><img src="<?php echo $this->baseUrl()?>/public/templates/administrator/images/article-icon.png"><p class="shortcut-text">Thêm bài viết mới</p></a></div>
	<div class="home-shorcut"><a href="<?php echo $this->url(array("module"=>"administrator","controller"=>"articlecat","action"=>"add"),null,true); ?>"><img src="<?php echo $this->baseUrl()?>/public/templates/administrator/images/article-cat-icon.png"><p class="shortcut-text">Thêm thể loại mới</p></a></div>
	<div class="home-shorcut"><a href="<?php echo $this->url(array("module"=>"administrator","controller"=>"file","action"=>"add"),null,true); ?>"><img src="<?php echo $this->baseUrl()?>/public/templates/administrator/images/files-icon.png"><p class="shortcut-text">Thêm file mới</p></a></div>
	
	<div class="home-shorcut"><a href="<?php echo $this->url(array("module"=>"administrator","controller"=>"filecat","action"=>"add"),null,true); ?>"><img src="<?php echo $this->baseUrl()?>/public/templates/administrator/images/file-cat-icon.png"><p class="shortcut-text">Thêm thể loại file mới</p></a></div>
	<div class="home-shorcut"><a href="<?php echo $this->url(array("module"=>"administrator","controller"=>"configuration","action"=>"index"),null,true); ?>"><img src="<?php echo $this->baseUrl()?>/public/templates/administrator/images/setting-icon.png"><p class="shortcut-text">Cấu hình website</p></a></div>
	<div class="home-shorcut"><a href="<?php echo $this->url(array("module"=>"administrator","controller"=>"product","action"=>"add"),null,true); ?>"><img src="<?php echo $this->baseUrl()?>/public/templates/administrator/images/products-icon.png"><p class="shortcut-text">Thêm sản phẩm mới</p></a></div>
</div>
<div class="home-right">
<h3>Danh sách bài viết mới nhất</h3>
	<table>
	<thead>
		<tr>
			<td>Id </td>
			<td>Tiêu đề</td>
			<td>Lượt xem</td>
		</tr>
	</thead>
	<tbody>
			<?php
				if(!empty($dataRecent)): 
			?>
			<?php foreach($dataRecent as $item): ?>
			<tr>
				<td><?php echo $item['id']; ?></td>
				<td><a href="<?php echo $this->baseUrl().$modelArticle->getLinkById($item['id'])?>" target="_blank"><?php echo substr($item['name'],0,40).'...'; ?></a></td>
				<td><?php echo $item['hit']; ?></td>
			</tr>
		     <?php endforeach; ?>		
		     <?php endif;?>	
	</tbody>
	
</table>
<br />
<h3>Danh sách bài viết xem nhiều nhất</h3>
	<table>
	<thead>
		<tr>
			<td>Id </td>
			<td>Tiêu đề</td>
			<td>Lượt xem</td>
		</tr>
	</thead>
	<tbody>
			<?php
				if(!empty($dataMostView)): 
			?>
			<?php foreach($dataMostView as $item): ?>
			<tr class="">
				<td><?php echo $item['id']; ?></td>
				<td><a href="<?php echo $this->baseUrl().$modelArticle->getLinkById($item['id'])?>" target="_blank"><?php echo substr($item['name'],0,40).'...'; ?></a></td>
				<td><?php echo $item['hit']; ?></td>
			</tr>
		     <?php endforeach; ?>		
		     <?php endif;?>	
	</tbody>
	
</table>
</div>
<div class="clear"></div>
